package com.gem.card;

import com.gem.entity.Card;
import com.gem.enums.CardType;
import com.gem.enums.GemType;
import com.gem.entity.Gem;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: Xhy
 * CreateTime: 2022-09-17 15:22
 *
 */
public class PrimaryCard extends Card {

    public Integer type = CardType.PRIMARY_CARD.getType();

    private static Integer no = 0;

    private static ArrayList<Card> cards = new ArrayList<>();


    /**
     * 初始化初级卡牌
     */
    static {
        cards.add(createPrimaryCardAndRedBuff(new Gem().white(1).red(1).black(3),0));
        cards.add(createPrimaryCardAndRedBuff(new Gem().blue(2).green(1),0));
        cards.add(createPrimaryCardAndRedBuff(new Gem().white(4),1));
        cards.add(createPrimaryCardAndRedBuff(new Gem().white(3),0));
        cards.add(createPrimaryCardAndRedBuff(new Gem().white(2).red(2),0));
        cards.add(createPrimaryCardAndRedBuff(new Gem().white(1).black(1).green(1).blue(1),0));
        cards.add(createPrimaryCardAndRedBuff(new Gem().white(2).blue(1).green(1).black(1),0));
        cards.add(createPrimaryCardAndRedBuff(new Gem().white(2).green(1).black(1),0));
        cards.add(createPrimaryCardAndWhiteBuff(new Gem().blue(2).green(2).black(1),0));
        cards.add(createPrimaryCardAndWhiteBuff(new Gem().green(4),1));
        cards.add(createPrimaryCardAndWhiteBuff(new Gem().blue(1).green(1).red(1).black(1),0));
        cards.add(createPrimaryCardAndWhiteBuff(new Gem().red(2).black(1),0));
        cards.add(createPrimaryCardAndWhiteBuff(new Gem().blue(3),0));
        cards.add(createPrimaryCardAndWhiteBuff(new Gem().blue(1).green(2).red(2),0));
        cards.add(createPrimaryCardAndWhiteBuff(new Gem().white(3).blue(1).black(1),0));
        cards.add(createPrimaryCardAndWhiteBuff(new Gem().blue(2).black(2),0));
        cards.add(createPrimaryCardAndBLUEBuff(new Gem().green(2).black(2),0));
        cards.add(createPrimaryCardAndBLUEBuff(new Gem().white(1).green(1).red(2).black(1),0));
        cards.add(createPrimaryCardAndBLUEBuff(new Gem().red(4),1));
        cards.add(createPrimaryCardAndBLUEBuff(new Gem().black(3),0));
        cards.add(createPrimaryCardAndBLUEBuff(new Gem().white(1).black(2),0));
        cards.add(createPrimaryCardAndBLUEBuff(new Gem().white(1).green(2).red(2),0));
        cards.add(createPrimaryCardAndBLUEBuff(new Gem().white(1).green(1).red(1).black(1),0));
        cards.add(createPrimaryCardAndBLUEBuff(new Gem().blue(1).green(3).red(1),0));
        cards.add(createPrimaryCardAndGreenBuff(new Gem().white(1).blue(1).red(1).black(2),0));
        cards.add(createPrimaryCardAndGreenBuff(new Gem().red(3),0));
        cards.add(createPrimaryCardAndGreenBuff(new Gem().blue(1).red(2).black(2),0));
        cards.add(createPrimaryCardAndGreenBuff(new Gem().white(2).black(1),0));
        cards.add(createPrimaryCardAndGreenBuff(new Gem().white(1).black(1).blue(1).red(1),0));
        cards.add(createPrimaryCardAndGreenBuff(new Gem().blue(2).red(2),0));
        cards.add(createPrimaryCardAndGreenBuff(new Gem().white(1).blue(3).green(1),0));
        cards.add(createPrimaryCardAndGreenBuff(new Gem().black(4),1));
        cards.add(createPrimaryCardAndBlackBuff(new Gem().blue(4),1));
        cards.add(createPrimaryCardAndBlackBuff(new Gem().green(3),0));
        cards.add(createPrimaryCardAndBlackBuff(new Gem().white(1).blue(1).green(1).red(1),0));
        cards.add(createPrimaryCardAndBlackBuff(new Gem().green(2).red(1),0));
        cards.add(createPrimaryCardAndBlackBuff(new Gem().green(1).red(3).black(1),0));
        cards.add(createPrimaryCardAndBlackBuff(new Gem().white(1).blue(2).green(1).red(1),0));
        cards.add(createPrimaryCardAndBlackBuff(new Gem().white(2).blue(2).red(1),0));
        cards.add(createPrimaryCardAndBlackBuff(new Gem().white(2).green(2),0));
    }
    // init 40 cards
    public static List<Card> init(){
        return cards;
    }

    public PrimaryCard(){

    }
    private PrimaryCard(Gem gem,Integer cardBuff,Integer score) {
       super.type = CardType.PRIMARY_CARD.type;
       super.gems = gem.toMap();
       super.cardBuff = cardBuff;
       super.score = score;
       super.no =no++;
    }

    private static PrimaryCard createPrimaryCardAndRedBuff(Gem gem,Integer score){
        return new PrimaryCard(gem,GemType.RED.getType(),score);
    }

    private static PrimaryCard createPrimaryCardAndWhiteBuff(Gem gem,Integer score){
        return new PrimaryCard(gem,GemType.WHITE.getType(),score);
    }

    private static PrimaryCard createPrimaryCardAndBlackBuff(Gem gem,Integer score){
        return new PrimaryCard(gem,GemType.BLACK.getType(),score);
    }

    private static PrimaryCard createPrimaryCardAndGreenBuff(Gem gem,Integer score){
        return new PrimaryCard(gem,GemType.GREEN.getType(),score);
    }

    private static PrimaryCard createPrimaryCardAndBLUEBuff(Gem gem,Integer score){
        return new PrimaryCard(gem,GemType.BLUE.getType(),score);
    }

}
